<template>
  <div class="box">{{ name }}</div>
  <div v-if="bill">哥哥给的钱{{ bill }}</div>
</template>
<script>
import { defineComponent, reactive, toRefs, onMounted } from 'vue'
import objData from '@/utils/obj'
import emitter from '@/utils/emitter'

export default defineComponent({
  name: 'SonPage2',
  components: {},
  setup() {
    const state = reactive({
      name: '李白',
      bill: '',
    })

    emitter.on('send-money', (val) => {
      state.bill = val
      console.log('val', val)
    })
    onMounted(() => {
      console.log('objData', objData)
    })

    return {
      ...toRefs(state),
    }
  },
})
</script>

<style scoped lang="scss">
.box {
  border: 1px solid #00b42a;
  padding: 20px;
  margin-top: 16px;
}
</style>
